package com.zfzs.post.modules.post.domain;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @author ck
* @date 2019-09-27
*/
@Entity
@Data
@Table(name="post_terminal_type")
public class TerminalType implements Serializable {

    // 主键
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    // 所属渠道 0 为总平台 所有的渠道都会有
    @Column(name = "channel_id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long channelId;

    // 型号
    @Column(name = "model")
    private String model;

    // 终端名称
    @Column(name = "terminal_name")
    private String terminalName;

    // 0: 正常 1：禁用
    @Column(name = "status")
    private Long status;

    // 创建日期
    @Column(name = "create_time")
    private Timestamp createTime;

    // 修改时间
    @Column(name = "update_time")
    private Timestamp updateTime;

    //说明图片
    @Column(name = "desc_img_id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long descImgId;

    //押金
    @Column(name = "deposit_amount")
    private BigDecimal depositAmount;

    //激活条件 满多少激活
    @Column (name = "activ_amount")
    private BigDecimal activAmount;

    public void copy(TerminalType source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}